package Cmd;
#Class for Dealing with Commands
use warnings;
use strict;
use Carp;

our $VERSION = 0.01;
$MyPackage::VERSION = 0.01;
use vars qw($VERSION);

#Vars
#command  - Name of Command
#where    - Calling Channel/Nick
#args     - Arguments for command
#ready    - Is Command ready to excute
#nick     - Nickname of calling Command
#level    - Nick Access Level - So we can grab it, if nick is approved.


#Constructor and initialisation
sub new
{
    my $class = shift;
    my $cmd = {@_};
    bless $cmd, $class;

    $cmd->_init;
    return $cmd;
}

sub _init
{
    my $cmd = shift;
    #push @cmdquenue, $cmd;
}

##Object Accessor methods
sub ready
{
    my $cmd = shift;
    unless (ref $cmd)
    {
        croak "ready() should be called with an object, not a class"; #Error Handling.
    }

    my $ready = shift;
    $cmd->{ready} = $ready if defined $ready;

    return $cmd->{ready};
}
sub where
{
    my $cmd = shift;
    unless (ref $cmd)
    {
        croak "where() should be called with an object, not a class"; #Error Handling.
    }

    return $cmd->{where};
}

sub command
{
    my $cmd = shift;
    unless (ref $cmd)
    {
        croak "command() should be called with an object, not a class"; #Error Handling.
    }

    return $cmd->{command};
}

sub nick
{
    my $cmd = shift;
    unless (ref $cmd)
    {
        croak "nick() should be called with an object, not a class"; #Error Handling.
    }

    return $cmd->{nick};
}

sub level
{
    my $cmd = shift;
    unless (ref $cmd)
    {
        croak "level() should be called with an object, not a class"; #Error Handling.
    }

    return $cmd->{level};
}

sub args
{
    my $cmd = shift;
    unless (ref $cmd)
    {
        croak "arg() should be called with an object, not a class"; #Error Handling.
    }

    return $cmd->{args};
}
#Class Accessor methods

#Utility Methods
# sub cmddone
# {
#     #Command is done, time to kill the object
#     my $cmd = shift;
#     unless (ref $cmd)
#     {
#         croak "cmddone() should be called with an object, not a class"; #Error Handling.
#     }
#
#     my $cmd = undef;
#     return undef;
# }

1;